/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.services.gl;

/**
 *
 * @author jay
 */

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.model.SelectItem;
import src.domain.gl.Tax;
import src.services.CRUEDService;

public class TaxModel implements java.io.Serializable {
    
    private CRUEDService service;
   
    
    public TaxModel() {
        service = new CRUEDService();
    }
    
    public List<Tax> findAll(Map<String, String> filters) {
        return (List<Tax>) service.findAll("Tax", filters);
    }
    
    public List<SelectItem> listAll() {
        return service.listAll("Tax", "taxId", "taxName");
    }
    
    public Tax getById(Integer id) {
        Map<String, String> where = new HashMap<>();
        where.put("tx.taxId", id.toString());
        if (id != null) 
        {
            if (id > 0) 
                return (Tax) service.getObjectSQL("from Tax as tx", where);
            else return null;
            
        } else return null;
    }
    
    
    
    public boolean saveData(Tax data) {
        return service.saveData(data);
    }
    
    public boolean deleteData(Tax data) {
        return service.deleteData(data);
    }

    
}
